package com.oa.office.dao;

import org.apache.ibatis.jdbc.SQL;

import com.oa.office.entity.ReportTableWithBLOBs;

public class ReportTableSqlProvider {

    public String insertSelective(ReportTableWithBLOBs record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("report_table");
        
        if (record.getId() != null) {
            sql.VALUES("id", "#{id,jdbcType=INTEGER}");
        }
        
        if (record.getFileName() != null) {
            sql.VALUES("file_name", "#{fileName,jdbcType=VARCHAR}");
        }
        
        if (record.getCreater() != null) {
            sql.VALUES("creater", "#{creater,jdbcType=VARCHAR}");
        }
        
        if (record.getCreateTime() != null) {
            sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdater() != null) {
            sql.VALUES("updater", "#{updater,jdbcType=VARCHAR}");
        }
        
        if (record.getUpdateTime() != null) {
            sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getState() != null) {
            sql.VALUES("state", "#{state,jdbcType=INTEGER}");
        }
        
        if (record.getReportTime() != null) {
            sql.VALUES("report_time", "#{reportTime,jdbcType=DATE}");
        }
        
        if (record.getReportType() != null) {
            sql.VALUES("report_type", "#{reportType,jdbcType=VARCHAR}");
        }
        
        if (record.getiSay() != null) {
            sql.VALUES("i_say", "#{iSay,jdbcType=INTEGER}");
        }
        
        if (record.getHeadSay() != null) {
            sql.VALUES("head_say", "#{headSay,jdbcType=INTEGER}");
        }
        
        if (record.getSpar2() != null) {
            sql.VALUES("spar2", "#{spar2,jdbcType=VARCHAR}");
        }
        
        if (record.getWaitWork() != null) {
            sql.VALUES("wait_work", "#{waitWork,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getOffWork() != null) {
            sql.VALUES("off_work", "#{offWork,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getHelp() != null) {
            sql.VALUES("help", "#{help,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getOther() != null) {
            sql.VALUES("other", "#{other,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getSpar() != null) {
            sql.VALUES("spar", "#{spar,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getReportPlan() != null) {
            sql.VALUES("report_plan", "#{reportPlan,jdbcType=LONGVARCHAR}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(ReportTableWithBLOBs record) {
        SQL sql = new SQL();
        sql.UPDATE("report_table");
        
        if (record.getFileName() != null) {
            sql.SET("file_name = #{fileName,jdbcType=VARCHAR}");
        }
        
        if (record.getCreater() != null) {
            sql.SET("creater = #{creater,jdbcType=VARCHAR}");
        }
        
        if (record.getCreateTime() != null) {
            sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdater() != null) {
            sql.SET("updater = #{updater,jdbcType=VARCHAR}");
        }
        
        if (record.getUpdateTime() != null) {
            sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getState() != null) {
            sql.SET("state = #{state,jdbcType=INTEGER}");
        }
        
        if (record.getReportTime() != null) {
            sql.SET("report_time = #{reportTime,jdbcType=DATE}");
        }
        
        if (record.getReportType() != null) {
            sql.SET("report_type = #{reportType,jdbcType=VARCHAR}");
        }
        
        if (record.getiSay() != null) {
            sql.SET("i_say = #{iSay,jdbcType=INTEGER}");
        }
        
        if (record.getHeadSay() != null) {
            sql.SET("head_say = #{headSay,jdbcType=INTEGER}");
        }
        
        if (record.getSpar2() != null) {
            sql.SET("spar2 = #{spar2,jdbcType=VARCHAR}");
        }
        
        if (record.getWaitWork() != null) {
            sql.SET("wait_work = #{waitWork,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getOffWork() != null) {
            sql.SET("off_work = #{offWork,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getHelp() != null) {
            sql.SET("help = #{help,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getOther() != null) {
            sql.SET("other = #{other,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getSpar() != null) {
            sql.SET("spar = #{spar,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getReportPlan() != null) {
            sql.SET("report_plan = #{reportPlan,jdbcType=LONGVARCHAR}");
        }
        
        sql.WHERE("id = #{id,jdbcType=INTEGER}");
        
        return sql.toString();
    }
}